package com.vitech.javacertification.threads.sharedcell;

class Producer extends Thread {
	
  private SharedCell cell;
  private boolean Stop = false;
  
  public Producer (SharedCell cell) {
    this.cell = cell;
  }
  
  public void setStop () {
    Stop = true;
  }
  
  public void run () {
    int value;
    while (!Stop) {
	value = (int) (Math.random () * 100);
	cell.store (value);
	try {
	  sleep (value);
	} catch (InterruptedException e) { }
     }
  }
}
